/*
 * @Author: your name
 * @Date: 2022-01-13 14:51:55
 * @LastEditTime: 2022-01-13 15:57:36
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /type-script-exercise/demo7.ts
 */
import { type } from 'os'

// 数组和元组
const numberArr = [1, 2, 3]
const numberArr2: (number | string)[] = []
const undefinedArr: undefined[] = [undefined]

const objectArr: { name: string; age: number }[] = [
  {
    name: 'yk',
    age: 22,
  },
]

// type alias 类型别名
type User = { name: String; age: number }

const objectArr1: User[] = [
  {
    name: 'sdff',
    age: 2,
  },
]

class Teacher {
  name: string
  age: number
}

const objectArr2L: Teacher[] = [
  new Teacher(),
  {
    name: 'ssd',
    age: 1,
  },
]

// 元组 tuple
const teacherInfo: (number | string)[] = ['dell', 'male', 18] // 没有约束项数类型
const teacherInfo1: [string, string, number] = ['dell', 'male', 18] // 没有约束项数类型  长度固定，每一项类型固定
// csv
const teacher1: [string, string, number][] = [
  ['dell', 'male', 18],
  ['dell', 'male', 18],
  ['dell', 'male', 18],
]
